package cn.wolfcode.wolf2world.myenum;

import cn.wolfcode.wolf2world.consts.Consts;
import lombok.Getter;

/**
 * @author 杨兴健
 * @Date 2020/8/8 23:04
 */

public enum RedisKeysEnum {

    /**累计访问数*/
    MYWO_TOTAL("mywo_total",-1L,"累计访问数"),
    /**今日访问数*/
    MYWO_TODAY("mywo_today",-1L,"今日访问数"),
    /**点赞key*/
    STRATEGY_THUMBSUP_SID_UID("strategy_thumbsup_sid_uid",-1L,"攻略点赞_攻略id_用户id"),
    /**用户攻略收藏*/
    USER_STRATEGY_FAVOR("user_strategy_favor",-1L,"用户攻略收藏"),
    /**攻略统计数*/
    STRATEGY_STATIC_VO("strategy_static_vo",-1L,"攻略统计数"),
    /**认证码前缀*/
    VERIFY_CODE("verify_code", Consts.VERIFY_CODE_TIME,"验证码前缀"),
    /**当前用户前缀*/
    USER_TOKEN("user_token",Consts.USER_TOKE_TIME,"当前用户前缀");

    @Getter
    private String prefix;
    @Getter
    private String msg;
    @Getter
    private Long time;

    private RedisKeysEnum(String prefix, Long time, String msg) {
        this.prefix = prefix;
        this.time = time;
        this.msg = msg;
    }

    /**
     * 拼接前缀
     * @param str
     * @return
     */
    public String join(String... str) {
        StringBuilder stringBuilder = new StringBuilder(80);
        stringBuilder.append(this.prefix);
        for (String s : str) {
            stringBuilder.append(":").append(s);
        }
        return stringBuilder.toString();
    }

}
